package com.yidu.logisticssystem.controller;

import com.yidu.logisticssystem.entity.LogisticsReceipt;
import com.yidu.logisticssystem.service.LogisticsReceiptService;
import com.yidu.logisticssystem.utils.BaseMessage;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (LogisticsReceipt)表控制层
 *
 * @author yuxigan
 * @since 2021-03-09 14:36:06
 */
@RestController
@RequestMapping("logisticsReceipt")
public class LogisticsReceiptController {
    /**
     * 服务对象
     */
    @Resource
    private LogisticsReceiptService logisticsReceiptService;

    /**
     * 通过货运单编号查询单条数据
     *
     * @param waynum 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public BaseMessage selectOne(String waynum) {
        LogisticsReceipt receipt=logisticsReceiptService.queryById(waynum);
        if(receipt==null){
            return BaseMessage.fail();
        }else {
            return BaseMessage.succes(receipt);
        }
    }
}
